// core/Colour.h

#ifndef _CORE_Colour_H_
#define _CORE_Colour_H_

#ifndef _CORE_Types_H_
#include <core/Types.h>
#endif
#include <math/Vector.hpp>

namespace CORE
{

class Colour
{
public:
	Colour();
	Colour(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha=255);

	// Acessors
	void		SetColour(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha=255);
	void		SetColour(const Colour & That);

	uint8_t		GetRed() const {
		return m_Colour[0];
	}
	uint8_t		GetGreen() const {
		return m_Colour[1];
	}
	uint8_t		GetBlue() const {
		return m_Colour[2];
	}
	uint8_t		GetAlpha() const {
		return m_Colour[3];
	}

	void		SetRed(uint8_t Red) {
		m_Colour[0] = Red;
	}
	void		SetGreen(uint8_t Green) {
		m_Colour[1] = Green;
	}
	void		SetBlue(uint8_t Blue) {
		m_Colour[2] = Blue;
	}
	void		SetAlpha(uint8_t Alpha) {
		m_Colour[3] = Alpha;
	}

	uint32_t	GetRGBA() const {
		return *(uint32_t *)m_Colour;
	}

	Math::vec4	GetValue() const {
		return Math::vec4(m_Colour[0] / 255.0f, m_Colour[1] / 255.0f, m_Colour[2] / 255.0f, m_Colour[3] / 255.0f);
	}

	// APIs
	const Colour &	operator=(const Colour & that);
	bool			operator==(const Colour & that) const;
	bool			operator!=(const Colour & that) const;

	Colour			operator+(const Colour & that) const;
	const Colour &	operator+=(const Colour & that);
	Colour			operator-(const Colour & that) const;
	const Colour &	operator-=(const Colour & that);

	Colour			operator*(float fFactor) const;
	const Colour &	operator*=(float fFactor);
	Colour			operator/(float fFactor) const;
	const Colour &	operator/=(float fFactor);

	uint8_t &		operator[] (int iIndex) {
		return m_Colour[iIndex];
	}
	const uint8_t &	operator[] (int iIndex) const {
		return m_Colour[iIndex];
	}

protected:

	uint8_t		m_Colour[4];
};

}; // namespace CORE


#endif